/*
* Tencent is pleased to support the open source community by making WeUI available.
* 
* Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
* 
* Licensed under the MIT License (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* 
*       http://opensource.org/licenses/MIT
* 
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions and
* limitations under the License.
*/

@import "../../base/fn";

.weui-dialog {
  position: fixed;
  z-index: 5000;
  top: 50%;
  left: 16px;
  right: 16px;
  transform: translate(0, -50%);
  background-color: @weuiDialogBackgroundColor;
  text-align: center;
  border-radius: 12px;
  overflow: hidden;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
  max-height: 90%;
  outline: 0;
  .hyphens;
}
.weui-dialog__hd {
  padding: 32px @weuiDialogGapWidth 16px;
}
.weui-dialog__title {
  font-weight: 500;
  font-size: 17px;
  line-height: 1.4;
  color: var(--weui-FG-0);
}
.weui-dialog__bd {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 @weuiDialogGapWidth;
  margin-bottom: 32px;
  font-size: 17px;
  line-height: 1.4;
  color: @weuiTextColorDesc;
  &:first-child {
    min-height: 40px;
    padding: 32px @weuiDialogGapWidth 0;
    font-weight: 500;
    color: @weuiTextColorTitle;
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    justify-content: center;
  }
}
.weui-dialog__ft {
  position: relative;
  display: flex;
  align-items: center;
  &::after {
    content: " ";
    .setTopLine(@weuiDialogLineColor);
  }
}
.weui-dialog__btn {
  flex: 1;
  display: block;
  line-height: (64-40)/17;
  padding: 20px 8px;
  font-size: 17px;
  color: @weuiDialogLinkColor;
  font-weight: 500;
  text-decoration: none;
  .setTapColor();

  user-select: none;
  &:active {
    background-color: @weuiDialogLinkActiveBc;
  }

  position: relative;
  overflow: hidden;//兼容小程序旁白点击无效
  &::after {
    content: " ";
    .setLeftLine(@weuiDialogLineColor);
  }
  &:first-child {
    &::after {
      display: none;
    }
  }
}
.weui-dialog__btn_default {
  color: var(--weui-FG-HALF);
}
.weui-dialog__btn_warn {
  color: var(--weui-RED);
}
.weui-dialog__btn_disabled {
  color: var(--weui-FG-2);
}
.weui-dialog_btn-wrap {
  .weui-dialog__ft {
    flex-direction: column;
    align-items: initial;
  }
  .weui-dialog__btn {
    &::after {
      width: auto;
      bottom: auto;
      right: 0;
      height: 1px;
      transform: scaleY(0.5);
      border-top: 1px solid var(--weui-DIALOG-LINE-COLOR);
      border-left: 0;
    }
    &:first-child {
      &::after {
        display: none;
      }
    }
  }
}

.weui-skin_android {
  .weui-dialog {
    text-align: left;
    box-shadow: 0 6px 30px 0 rgba(0, 0, 0, 0.1);
  }
  .weui-dialog__title {
    font-size: 22px;
    line-height: 1.4;
  }
  .weui-dialog__hd {
    text-align: left;
  }
  .weui-dialog__bd {
    color: @weuiTextColorDesc;
    text-align: left;
    &:first-child {
      color: @weuiTextColorTitle;
    }
  }
  .weui-dialog__ft {
    display: block;
    text-align: right;
    line-height: 40px;
    min-height: 40px;
    padding: 0 @weuiDialogGapWidth 16px;
    &::after {
      display: none;
    }
  }
  .weui-dialog__btn {
    display: inline-block;
    vertical-align: top;
    padding: 0 0.8em;
    &::after {
      display: none;
    }
    &:last-child {
      margin-right: -0.8em;
    }
  }
  .weui-dialog__btn_default {
    color: var(--weui-FG-HALF);
  }
}

@media screen and (min-width: 352px) {
  .weui-dialog {
    width: 320px;
    margin: 0 auto;
  }
}
